package com.neu.wms.service.impl;

import com.neu.wms.dto.WarehouseDto;
import com.neu.wms.entity.WmsWarehouse;
import com.neu.wms.mapper.WmsWarehouseMapper;
import com.neu.wms.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class WarehouseServiceImpl implements WarehouseService {
    @Autowired
    WmsWarehouseMapper wmsWarehouseMapper;
    @Override
    public List<WmsWarehouse> selectAll(WarehouseDto warehouseDto) {
        return wmsWarehouseMapper.selectAll(warehouseDto);
    }

    @Override
    public WmsWarehouse selectByPrimaryKey(Long id) {
        return wmsWarehouseMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insert(WmsWarehouse wmsWarehouse) {
        wmsWarehouse.setStatus(0);
        return wmsWarehouseMapper.insert(wmsWarehouse);
    }

    @Override
    public int update(WmsWarehouse wmsWarehouse) {
        return wmsWarehouseMapper.updateByPrimaryKeySelective(wmsWarehouse);
    }

    @Override
    public int updateDelFlag(WarehouseDto warehouseDto) {
        return wmsWarehouseMapper.updateDelFlag(warehouseDto);
    }

    @Override
    public int delete(Long id) {
        return wmsWarehouseMapper.deleteByPrimaryKey(id);
    }
}
